#ifndef sensors_h
#define sensors_h

/**
 * @defgroup nxbot_sensors SENSORS Library
 * @ingroup nxbot_high_level
 * @code #include <sensors.h> @endcode
 * @brief PWM library for applying different velocities to the motors in NXBOT. 
 *
 * This module uses timer0 of the ATmega1281 microcontroller for generating the desired PWM signals. Timer0 is configured in <i>Free Running mode</i>,
 * and it is constantly compared with two registers (OC0 and OC1), in order to toggle the logical state of two pins, where the PWM signals to the
 * motors are connected. Another two signals are used in order to set the desired direction of the motor. For FORWARD direction use <b>positive</b>
 * values, for BACKWARD direction use <b>negative</b> values.
 * This library does not need to have the interrupts in order to function correctly, it is not an interrupt-driven module.
 * 
 */
 
/**@{*/
#include "structures.h"
#include "ir.h"
#include "bumpers.h"
#include "battery.h"
#include "sonar.h"

/*************************************************************************
Routine: 	READIR
Purpose:  	Reads the value of each one of the IR sensors
In:			void
Out:		char value that contains the result of the IR register
**************************************************************************/
//TODO: Las funciones deberian cambiar el nombre a read()
#define sensors_getIR() ir_read()
#define sensors_getBumpers() bumpers_read()
#define sensors_getBattState() battery_read(BATT_READ_PERC)
#define sensors_getBattVoltage() battery_read(BATT_READ_VOLT)
#define sensors_getSonar(x,y,s) sonar_read(x,y,s)
#define sensors_setSonar(x,u) sonar_write(x,u)


void sensors_readAll(sensors_t *sens);
/*************************************************************************
Routine: 	CONFIGIR
Purpose:  	Configure the hardware that deals with the IR Sensors.
In:			float frequency of update
Out:		void
**************************************************************************/
void sensors_init(void);

/**@}*/
#endif
